package com.killer.serializer;

import com.alibaba.fastjson.JSON;

import java.io.IOException;

/**
 * @author ：Killer
 * @date ：Created in 20-11-27 上午9:55
 * @description：${description}
 * @modified By：
 * @version: version
 */
public class JsonSerializer implements Serializer{
    public byte[] serialize(Object object) throws IOException {
        return JSON.toJSONBytes(object);
    }

    public <T> T deserialize(Class<T> clazz, byte[] bytes) throws IOException {
        return JSON.parseObject(bytes, clazz);
    }
}
